package Player;

import Player.IAStrategy.IAStrategy;
import Player.IAStrategy.IAStrategyFactory;
//Singleton + Factory
public class PlayerFactory 
{
    private static final PlayerFactory instance = new PlayerFactory();

	private PlayerFactory(){}
	
	public final static PlayerFactory getInstance() 
	{
        return instance;
    }
	
	public Player createPlayer(String name, String type, String strategy)
	{
		if(type.equals("HM"))
			return new HumanPlayer(name);
		else if(type.equals("IA"))
		{
			IAStrategy strat = IAStrategyFactory.getInstance().createIAStrategy(strategy);
			if(strat != null)
				return new IAPlayer(name, strat);
		}
		return null;
	}
}
